#
# @lc app=leetcode.cn id=69 lang=python3
#
# [69] x 的平方根
#

# @lc code=start
class Solution:
    def mySqrt(self, x: int) -> int:
        def sqrts(x0,a):#牛顿迭代法
            n = (x0+a/x0)/2
            if int(x0)==int(n):
                return int(x0)
            else:
                return sqrts(n,a)
        
        if x == 0:
            return 0
        return sqrts(x,x)

# @lc code=end

